home *** CD-ROM | disk | FTP | other *** search
- Path: zetnet.co.uk!demon!exel.demon.co.uk
- From: Jason Hambleton <jkh@exel.co.uk>
- Newsgroups: comp.lang.c
- Subject: ANSI var-arglist processing
- Date: Fri, 09 Feb 1996 10:16:18 +0000
- Organization: Exel Computer Systems
- Message-ID: <311B1EF2.7673@exel.co.uk>
- NNTP-Posting-Host: exel.demon.co.uk
- X-NNTP-Posting-Host: exel.demon.co.uk
- X-Mailer: Mozilla 2.0 (Win95; I)
- MIME-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
-
- HHHEEEEEEELLLLPPPP!!!!
-
- Can anybody tell me how to do this in *ANSI* (I can get it to
- work perfectly in NON_ANSI).
-
- I'm trying to call a function will a var-arglist, do nothing with it,
- and then pass the arg-list through to another function.
-
- Heres the code I'm trying to get working.
-
- Jason Hambleton
- jkh@exel.co.uk
- Exel Computer Systems, Nottingham (UK)
-
-
-
-
- #include "stdio.h"
- #include "stdarg.h"
-
- func2(char *fmt, ...)
- {
- va_list args;
- char buffer[81];
-
- va_start(args, fmt);
- vsprintf(buffer, fmt, args);
- va_end(args);
-
- printf("RESULT = (%s)\n", buffer);
- }
-
- func1(char *fmt, ...)
- {
- /* How do I pass the arg-list from here, to the next function */
-
- func2(fmt, ????????);
- }
-
- main()
- {
- func1("test %d", 45);
- }
-